Convert and show bytes representationΒΆ
A.tobytes()
Convert an array to an array of machine values and return the bytes representation.
from array import *
print("Bytes to String: ")
AB = array('b', [119, 51, 114, 101, 115, 111, 117, 114, 99, 101])
S = AB.tobytes()
print(S) # b'w3resource'
See also: https://www.w3resource.com/python-exercises/array/python-array-exercise-8.php